package com.clkj.xiuzheng.dao;

import com.clkj.xiuzheng.pojo.Customer;
import com.clkj.xiuzheng.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author yawang
 * @create 2024/04/18 11:35:41
 **/
@Repository
public interface CustomerMapper extends Mapper<Customer> {
    @Insert("insert into t_cl_customer values (#{customerName},#{customerSex},#{customerShopName},#{customerTel}," +
            "#{customerAddress},#{customerNote},#{customerLong},#{customerLat},#{userId},#{customerPosition},#{companyId},#{customerImg},#{customerFirstWord})")
    @Options(useGeneratedKeys = true, keyProperty = "customerId")
    void addCustomer(Customer customer);

    @Select("select * from t_cl_user where user_name like '%${userName}%' ")
    List<User> getVisitUserByName(@Param("userName") String userName);
}
